import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n

import VueMoment from 'vue-moment'

import '@/styles/index.scss' // global css

import App from './App'
import router from './router'
import store from './store'

import '@/icons' // icon
import '@/errorLog' // error log
import '@/permission' // permission control

import '@/utils/number'

// import '@/mockjs'

import RoleBtns from '@/mixins/roleBtns'
Vue.mixin(RoleBtns)

import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload)

import * as filters from '@/filters'
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

import permDirective from './directive/permission'
Vue.use(permDirective)

Vue.use(VueMoment)
Vue.use(ElementUI, { locale })

import Dialog from './components/Dialog'
Vue.use(Dialog)
Vue.prototype.$$loading = options => {
  return Vue.prototype.$loading(Object.assign({
    lock: true,
    text: '处理中，请稍等',
    spinner: 'el-icon-loading',
    background: 'rgba(0, 0, 0, 0.7)'
  }, options))
}
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
